﻿using System.Collections.Generic;
using MongoDB.Bson;
using Newtonsoft.Json;
using System;

namespace Model
{
    /// <summary>
    /// 问卷
    /// </summary>
    public class QustionPaper
    {
        /// <summary>
        /// 主键
        /// </summary>
        [JsonIgnore]
        public ObjectId _id { get; set; }

        /// <summary>
        /// 流水号
        /// </summary>
        public string Serid { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string AddName { get; set; }


        /// <summary>
        /// 创建人
        /// </summary>
        public string AddNameId { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public string AddTime { get; set; }

        /// <summary>
        /// 是否可以重复填写
        /// </summary>
        public bool CanRepeat { get; set; }

        /// <summary>
        /// 问题
        /// </summary>
        public List<Question> Question { get; set; }

    }

    /// <summary>
    /// 题型
    /// </summary>
    public class Question
    {
        public string Id { get; set; }

        /// <summary>
        /// 题目类
        /// </summary>
        public int QType { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 选项内容
        /// </summary>
        public List<Option> OptionList { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }

    }

    /// <summary>
    /// 选项
    /// </summary>
    public class Option
    {
        /// <summary>
        /// 选项ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 选项标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 选项值
        /// </summary>
        public int Value { get; set; }

        /// <summary>
        /// 是否时其他选项（带文本框）
        /// </summary>
        public bool IsOthers { get; set; }

        /// <summary>
        /// 其他的值
        /// </summary>
        public string OrthenValue { get; set; }

        public int Sort { get; set; }
    }


    /// <summary>
    /// 答卷记录
    /// </summary>
    public class AnswerRecords
    {
        /// <summary>
        /// 主键
        /// </summary>
        [JsonIgnore]
        public ObjectId _id { get; set; }

        /// <summary>
        /// 答卷人IP
        /// </summary>
        public string Ip { get; set; }


        private string _answersTime = "2000-01-01";

        /// <summary>
        /// 答卷时间
        /// </summary>
        public string AnswersTime
        {
            get { return _answersTime; }
            set { _answersTime = value; }
        }

        private string _PaperSerid = string.Empty;

        /// <summary>
        /// 问卷套餐Id（回答的是哪一份问卷）
        /// </summary>
        public string PaperSerid
        {
            get { return _PaperSerid; }
            set { _PaperSerid = value; }
        }

        /// <summary>
        /// 问题和答案
        /// </summary>
        public List<AnswerQuestion> AnswerQuestion { get; set; }


    }

    /// <summary>
    /// 问题和答案
    /// </summary>
    public class AnswerQuestion
    {
        /// <summary>
        /// 问卷的题目ID
        /// </summary>
        public string QuestId { get; set; }

        /// <summary>
        /// 题目类
        /// </summary>
        public int QuestType { get; set; }

        /// <summary>
        /// 问题的标题
        /// </summary>
        public string QuestTitle { get; set; }

        /// <summary>
        /// 问题的值
        /// </summary>
        public object Value { get; set; }

        public bool IsNeed { get; set; }

        /// <summary>
        /// 问题的选项
        /// </summary>
        public List<Option> OptionList { get; set; }

        /// <summary>
        /// 答案
        /// </summary>
        public List<Answer> Answer { get; set; }

    }


    /// <summary>
    /// 答案
    /// </summary>
    public class Answer
    {
        public string Value { get; set; }

        public string Content { get; set; }

        public string OthenContent { get; set; }

    }



}
